package com.guochenglang.www.service;

import com.guochenglang.www.pojo.InviteMessage;
import com.guochenglang.www.service.anotate.Affair;

import java.sql.SQLException;
import java.util.ArrayList;

/**
 * @author GuoChenglang
 */
public interface InviteService {
    /**
     * 邀请用户
     *
     * @param userId   邀请人用户id
     * @param baseId   知识库id
     * @param username 邀请的用户名
     * @return 添加邀请的主键
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    @Affair
    int addInvite(Integer userId, Integer baseId, String username) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 获取用户邀请列表个数
     *
     * @param username 用户名
     * @return 邀请列表个数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    int getInviteCount(String username) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 获取用户邀请列表
     *
     * @param username 用户名
     * @return 邀请列表
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    ArrayList<InviteMessage> showInviteMessages(String username) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 删除邀请
     *
     * @param username 用户名
     * @param baseId   知识库id
     * @return 删除行数
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    @Affair
    int deleteInvite(String username, Integer baseId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;

    /**
     * 接受邀请
     *
     * @param baseId 知识库id
     * @param userId 用户id
     * @return member的主键
     * @throws SQLException           sql异常
     * @throws InterruptedException   断点异常
     * @throws IllegalAccessException 非法访问异常
     * @throws InstantiationException 实现异常
     */
    @Affair
    int acceptService(Integer baseId, Integer userId) throws SQLException, InterruptedException, IllegalAccessException, InstantiationException;
}
